package com.pmsystem.service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.pmsystem.dao.ElectricConsumeMapper;
import com.pmsystem.dao.PayServerMapper;
import com.pmsystem.pojo.ElectricConsume;
import com.pmsystem.pojo.PayServer;
import com.pmsystem.util.BeanUtil;
import com.pmsystem.util.account.CashAccount;
import com.pmsystem.util.account.CashAccountImpl;

@Service
public class ElectricConsumeService {
	
	@Autowired
	private ElectricConsumeMapper electricConsumeMapper;

	@Autowired
	private PayServerMapper payServerMapper;
	/**
	 * 
	 * <p>Title: addElectricConsume</p >  
	 * <p>Description: 录入电费</p >  
	 * @author 泽强
	 * @param electricConsume
	 * @return
	 */
	public boolean addElectricConsume(ElectricConsume electricConsume) {
		int flag = electricConsumeMapper.insertSelective(electricConsume);
		return flag==1?true:false;
	}

	/**
	 * 
	 * <p>Title: updateElectricConsume</p >  
	 * <p>Description: 修改电费</p >  
	 * @author 泽强
	 * @param electricConsume
	 * @return
	 */
	public boolean updateElectricConsume(ElectricConsume electricConsume) {
		int flag = electricConsumeMapper.updateByPrimaryKeySelective(electricConsume);
		return flag==1?true:false;
	}
	
	/**
	 * 
	 * <p>Title: findElectricConsume</p >  
	 * <p>Description: 按一定条件查询电费</p >  
	 * @author 泽强
	 * @param map
	 * @return
	 */
	public List<ElectricConsume> findElectricConsume(Map<String, Object> map) {
		List<ElectricConsume> list = electricConsumeMapper.findElectricConsume(BeanUtil.mapToMapWithoutNull(map));	
		return list;
	} 

}
